package OOday03.HomeWork;

/**
 *测试
 */
public class PolymorphicDemo {
    public static void main(String[] args) {
//        Animal[] animals=new Animal[4];
//        animals[0]=new Dog("笑话",2,"白色");
//        animals[1]=new Dog("百花",2,"白色");
//        animals[2]=new Fish("小鱼",2,"白色");
//        animals[3]=new Chick("小鸡",2,"黑色");
//        for (int i=0;i<animals.length;i++){
//            System.out.println(animals[i].name);
//            animals[i].eat();
//            animals[i].drink();
//            if (animals[i] instanceof Dog) {
//                ((Dog) animals[i]).lookHome();
//            }
//            if (animals[i] instanceof Chick){
//                ((Chick) animals[i]).layEggs();
//            }
//            if (animals[i] instanceof Swim){
//                ((Swim) animals[i]).swim();
//            }
//        }
        Master ma=new Master();
        Dog dg=new Dog("小狗",2,"白色");
        Chick ck=new Chick("小埃及",2,"百色");
        Fish fh= new Fish("小于",2,"白色");
        ma.feed(dg);
        ma.feed(ck);
        ma.feed(fh);

    }
}
